<?php
/*
+--------------------------------------------------------------------------
|   WeCenter [#RELEASE_VERSION#]
|   ========================================
|   by WeCenter Software
|   © 2011 - 2014 WeCenter. All Rights Reserved
|   http://www.wecenter.com
|   ========================================
|   Support: WeCenter@qq.com
|
+---------------------------------------------------------------------------
*/


if (!defined('IN_ANWSION'))
{
	die;
}

class advtise_class extends AWS_MODEL
{
    
    public function get_advtise_info_by_id($article_id)
	{
		if (!is_digits($article_id))
		{
			return false;
		}

		static $articles;

		if (!$articles[$article_id])
		{
			$articles[$article_id] = $this->fetch_row('advertise', 'id = ' . $article_id);
		}

		return $articles[$article_id];
	}
        
    public function remove_advtise($article_id)
	{
		if (!$article_info = $this->get_advtise_info_by_id($article_id))
		{
			return false;
		}
		return $this->delete('advertise', 'id = ' . intval($article_id));
	}
        
        public function  publish_approval($data){           
            return $this->insert('advertise', array(
			'link_url'=>$data['link_url'],
                        'img_url'=>$data['img_url'],
                        'bind_id'=>$data['bind_id'],
                        'desc'=>$data['desc'],
                        'title'=>$data['title'],
                        'is_use'=>1,
			'add_time' => time()
		));
        }
    /**
     * 更新广告
     *
     * @param string
     * @param uid
     */
    public function update_advertise($update, $uid)
    {
        $this->update('advertise', $update,'id = ' . intval($uid));
        return true;
    }
} 